package me.haoliang

/**
  * author: planck
  * createTime: 2016/10/13.
  */
class ApplyScala {
  val name = "luhui";

  def apply(): Unit = {
    println("class apply()")
  }
}

object ApplyScala {
  def apply() = {
    println("object apply")
    new ApplyScala
  }

  def main(args: Array[String]): Unit = {
    //类名()->调用了对应object下的apply方法
    val a1= ApplyScala()
    println(a1.name)
    //对象名()->调用了对应class的apply方法
    a1()
  }
}
